package web.hibernate;

import javax.persistence.*;
import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 * User: user
 * Date: Jan 31, 2010
 * Time: 9:15:04 PM
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(catalog = "strutshibernatespring", name = "tests")
public class TestsEntity {
  private char[] testId;

  @Id
  @Column(name = "test_id", nullable = false, length = 20)
  public char[] getTestId() {
    return testId;
  }

  public void setTestId(char[] testId) {
    this.testId = testId;
  }

  private char[] testName;

  @Basic
  @Column(name = "test_name", nullable = false, length = 500)
  public char[] getTestName() {
    return testName;
  }

  public void setTestName(char[] testName) {
    this.testName = testName;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    TestsEntity that = (TestsEntity) o;

    if (!Arrays.equals(testId, that.testId)) return false;
    if (!Arrays.equals(testName, that.testName)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = testId != null ? Arrays.hashCode(testId) : 0;
    result = 31 * result + (testName != null ? Arrays.hashCode(testName) : 0);
    return result;
  }
}
